<!DOCTYPE html>
<html>
<head>
    <title>MVVM</title>
    <meta charset="utf-8">
    <link href="../content/shared/styles/examples-offline.css" rel="stylesheet">
    <link href="../../styles/kendo.common.min.css" rel="stylesheet">
    <link href="../../styles/kendo.rtl.min.css" rel="stylesheet">
    <link href="../../styles/kendo.default.min.css" rel="stylesheet">
    <link href="../../styles/kendo.dataviz.min.css" rel="stylesheet">
    <link href="../../styles/kendo.dataviz.default.min.css" rel="stylesheet">
    <script src="../../js/jquery.min.js"></script>
    <script src="../../js/kendo.all.min.js"></script>
    <script src="../content/shared/js/console.js"></script>
    <script>
        
    </script>
    
    
</head>
<body>
    
        <a class="offline-button" href="../index.html">Back</a>
    
    <div id="example">
    <div class="demo-section">
        <div class="box-col" style="width: 500px;">
            <h4>Hover some series</h4>
            <div data-role="chart"
                 data-legend="{ position: 'bottom' }"
                 data-series-defaults="{ type: 'column' }"
                 data-series="[
                                 { field: 'nuclear', name: 'Nuclear electricity' },
                                 { field: 'hydro', name: 'Hydro electricity' },
                                 { field: 'wind', name: 'Wind electricity' }
                             ]"
                 data-bind="visible: isVisible,
                            source: electricity,
                            events: { seriesHover: onSeriesHover }"></div>
        </div>
        <div class="box-col">
            <h4>Console</h4>
            <div class="console"></div>
        </div>
    </div>
    <div class="box">
        <div class="box-col" style="width: 500px">
            <h4>Configuration</h4>
            <div>
                <label><input type="checkbox" data-bind="checked: isVisible">Visible</label>
            </div>
        </div>
        <div class="box-col">
            <h4>Information</h4>
            Kendo UI Chart supports the
            <a href="http://docs.telerik.com/kendo-ui/getting-started/framework/mvvm/bindings/events">events</a>,
            <a href="http://docs.telerik.com/kendo-ui/getting-started/framework/mvvm/bindings/source">source</a> and
            <a href="http://docs.telerik.com/kendo-ui/getting-started/framework/mvvm/bindings/visible">visible</a> bindings.
        </div>
    </div>
<script>
    function createChart() {
        var viewModel = kendo.observable({
            isVisible: true,
            onSeriesHover: function(e) {
                 kendoConsole.log(kendo.format("event :: seriesHover ({0} : {1})", e.series.name, e.value));
            },
            electricity: new kendo.data.DataSource({
                transport: {
                    read: {
                        url: "../content/dataviz/js/spain-electricity.json",
                        dataType: "json"
                    }
                },
                sort: {
                    field: "year",
                    dir: "asc"
                }
            })
        });
        kendo.bind($("#example"), viewModel);
    }

    $(document).ready(createChart).bind("kendo:skinChange", createChart);

</script>
</div>


    
    
        <div class='demo-section'>
            <h3>Note:</h3>
            <p>
                Security restrictions prevent this example from working in all browsers when the page is loaded from the file system (via file:// protocol).
                If the demo is not working as expected, please host the Kendo folder on a web server.
            </p>
        </div>
    
</body>
</html>
